package com.funquer.commons.log;

import org.apache.log4j.Logger;

/**
 * Created with IntelliJ IDEA.
 * User: Administrator
 * Date: 13-3-21
 * Time: 下午3:23
 * To change this template use File | Settings | File Templates.
 */
public class LogManager {
    /**
     * 获取错误 Logger
     * @param logUrl
     * @return Logger
     */
    public static Logger getErrorLog(Object logUrl ){
        //logUrl is class
        if (logUrl instanceof Class ){
            return Logger.getLogger ( "error." +((Class )logUrl ).getName());
        }else if (logUrl instanceof String){
            return Logger.getLogger ( "error." +logUrl );
        }else{
            return Logger.getRootLogger ();
        }
    }

    /**
     * 获取操作 Logger
     * @param logUrl
     * @return Logger
     */
    public static Logger getProcessLog(Object logUrl){
        //logUrl is class
        if (logUrl instanceof Class ){
            return Logger.getLogger ( "process." +((Class )logUrl).getName());
        }else if (logUrl instanceof String){
            return Logger.getLogger ( "process." +logUrl);
        }else{
            return Logger.getRootLogger ();
        }
    }
}
